{% load staticfiles %}

<!DOCTYPE html>
<html lang="zh-cn" class="login-html">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
    重置密码 - Python技术杂货铺
</title>
<meta name="author" content="sunmouren" />
<meta name="description" content="Python技术杂货铺" />
<meta name="keywords" content="python, django, 大学生活，写作，技术分享" />
<link rel="icon" href="{% static 'images/favicon.ico' %}">
<link  href="{% static 'css/animate.min.css' %}" rel='stylesheet'/>
<link href="{% static 'css/bootstrap.min.css' %}" rel='stylesheet'/>
<link href="{% static 'css/font-awesome.min.css' %}" rel='stylesheet'>
<link href="{% static 'css/style.css' %}" rel='stylesheet'/>
</head>
  
<body class="nopadding login-box">
<div class="login">
  <div class="login-body">
    <a class="login-brand" href="#">
      <img class="img-responsive" src="{% static 'images/logo.jpg' %}" alt="" />
    </a>
    <div class="login-form">
      <form action="{% url 'users:post_reset_pwd' %}" method="post" target="_top">
        {% csrf_token %}
        <div class="form-group has-icon {% if reset_pwd_form.errors.password1 %}has-error{% endif %}">
          <label class="control-label" >新密码</label>
          <input id="email" class="form-control" type="text" name="password1"  placeholder="设置新密码" required autocomplete="off" />
        </div>
        <div class="form-group has-icon {% if reset_pwd_form.errors.password2 %}has-error{% endif %}">
          <label class="control-label" >确认密码</label>
          <input id="email" class="form-control" type="text" name="password2"  placeholder="确认密码" required autocomplete="off" />
        </div>
        <input type="hidden" name="email" value="{{ email }}">
        <button class="btn btn-teal btn-block" id="login" type="submit">发 送</button>

        <!--账户密码错误提示-->
        {% if msg or reset_pwd_form.errors.items %}
             <div class="alert alert-danger">
                <a href="#" class="close" data-dismiss="alert" >&times;</a>
                {% for key, error in login_form.errors.items %}
                    {{ error }}
                {% endfor %}
                 {{ msg }}
             </div>
        {% endif %}
      </form>
    </div>
  </div>
</div>

<script src="{% static 'js/jquery.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/bootstrap.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/jquery.lazyload.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/bootstrap-notify.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/app.js' %}" type="text/javascript"></script>
<script type="text/javascript">
    {% ifequal active_status 'ok' %}
        tips('验证成功，请填写新的密码!', 'success');
    {% endifequal %}

    {% ifequal reset_status 'ko' %}
        tips('重置失败，两次密码不一致', 'danger');
    {% endifequal %}

    {% ifequal reset_status 'ok' %}
        tips('修改密码成功，即将跳转到登录界面', 'success');
        setTimeout(function () {
            window.location.href = '/user/login/';
        }, 1500);
    {% endifequal %}
</script>

</body>
</html>